package com.zxy.supplier_system.server.controller

import com.zxy.supplier_system.server.service.MarketShoppingGuideSalaryPlanDetailPreviewService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.math.BigDecimal

@RestController()
@RequestMapping("markets/shoppingGuideSalaryPlans/rules")
class MarketShoppingGuideSalaryPlanDetailPreviewController(
    private val marketShoppingGuideSalaryPlanDetailPreviewService: MarketShoppingGuideSalaryPlanDetailPreviewService
) {

    @GetMapping("{ruleId}/year/{year}/month/{month}/detail/preview")
    fun previewDetail(@PathVariable ruleId: Int, @PathVariable month: Int, @PathVariable year: Int,): List<MarketShoppingGuideSalaryPlanRuleDetailPreviewResponse> {
        return marketShoppingGuideSalaryPlanDetailPreviewService.previewDetail(ruleId, month, year,)
    }

    data class MarketShoppingGuideSalaryPlanRuleDetailPreviewResponse(
        val barcode: String,
        val id: Int,
        val name: String,
        val saleAmount: Int,
        val saleFee: BigDecimal,
    )

}